
<div id="app">
    <section class="content-header">
        <h1>
            <small>订单分期列表</small>
        </h1>
    </section>

    <section class="content">
        <div class="row">
            <div class="col-md-12">
                <div class="box">
                    <div class="box-header with-border">



                    </div>





                    <!-- /.box-header -->
                    <!--数据列表开始   -->
                    <div class="box-body table-responsive no-padding">
                        <table class="table table-hover"  >
                            <thead >
                            <tr >
                                <th>还款状态</th>
                                <th>当前期数</th>
                                <th>分期表ID</th>
                                <th>期租金（元）</th>
                                <th>账单日</th>
                                <th>支付时间</th>
                                <th>安装包费</th>
                                <th>优惠券减免金额</th>
                                <th>逾期天数</th>
                                <th>逾期金额</th>
                                <th>备注</th>
                            </tr>
                            </thead>

                            <tbody>

                            @if (!empty($data))
                                @foreach($data as $v)
                                    <tr >
                                        <td >
                                            {{ $v['fq_status'] }}
                                        </td>
                                        <td >
                                            {{$v['current_tenancy_term']}}
                                        </td>
                                        <td >
                                            {{$v['id']}}
                                        </td>

                                        <td >
                                            {{$v['monthly_rent']}}
                                        </td>
                                        
                                        <td >
                                            {{$v['repayment_time']}}
                                        </td>
                                        <td >
                                            {{$v['last_repayment_time']}}
                                        </td>
                                        <td >
                                            {{$v['goods_installation_charge']}}
                                        </td>
                                        <td >
                                            {{$v['cou_credit_amount']}}
                                        </td>
                                        <td >
                                            {{$v['days_overdue']}}
                                        </td>
                                        <td >
                                            {{$v['amount_override']}}
                                        </td>
                                        <td >
                                            {{$v['remarks']}}
                                        </td>

                                    </tr>
                                @endforeach
                            @else
                                <tr><td style="text-align: center;color:#aaa" colspan="11">无数据</td></tr>
                            @endif
                            </tbody>
                        </table>
                    </div>
                    <!--数据列表结束-->




                    <!-- /.box-body -->
                </div>
            </div>
        </div>

    </section>
</div>

<script data-exec-on-popstate>

    $(function () {
        $("#cou_status").val("@if(!empty($where['cou_status'])){{$where['cou_status']}}@endif");
        $("#is_breaks").val("@if(!empty($where['is_breaks'])){{$where['is_breaks']}}@endif");

        //多选id数组
        var selectedRows = function () {
            var selected = [];
            $('.grid-row-checkbox:checked').each(function(){
                selected.push($(this).data('id'));
            });
            return selected;
        }

        //tr选中样式控制
        $('.grid-row-checkbox').iCheck({checkboxClass:'icheckbox_minimal-blue'}).on('ifChanged', function () {
            if (this.checked) {
                $(this).closest('tr').css('background-color', '#ffffd5');
            } else {
                $(this).closest('tr').css('background-color', '');
            }
        });


        $('.grid-select-all').iCheck({checkboxClass:'icheckbox_minimal-blue'});
        $('.grid-select-all').on('ifChanged', function(event) {
            if (this.checked) {
                $('.grid-row-checkbox').iCheck('check');
            } else {
                $('.grid-row-checkbox').iCheck('uncheck');
            }
        });

        //刷新
        $('.grid-refresh').on('click', function() {
            $.pjax.reload('#pjax-container');
            toastr.success('刷新成功 !');
        });

        //搜索
        $('.shaixuan-filter-btn').unbind('click');
        $('.shaixuan-filter-btn').click(function (e) {
            if ($('#filter-box').is(':visible')) {
                $('#filter-box').addClass('hide');
            } else {
                $('#filter-box').removeClass('hide');
            }
        });



        //改变分页量
        $('.grid-per-pager').on("change", function(e) {
            $.pjax({url: this.value, container: '#pjax-container'});
        });

        //分页
        $("a.page-link").click(function(e){
            var url=$(this).attr('data-href');
            $.pjax({url:url, container: '#pjax-container'});
        })
    });

    //删除或不删除
    function del(id){
        if(confirm('确定要删除吗')){
            $.ajax({
                url:"/admin/coupon/delete",
                data:{cou_id:id,_token:LA.token},
                type:'post',
                dataType:'json',
                success:function(m){
                    if(m.status==1){
                        toastr.success(m.message);
                        $.pjax.reload('#pjax-container');
                    }else{
                        swal(m.message, '', 'error');
                    }
                }
            });
        }

    }
</script>